<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<script type="text/javascript">
	$(function(){
		$(".lb_close").click(function() {
			$("#lb_pic").empty().hide();
		});
	});
	
	function doingUploadImgNew(){
		var filepath=$("#upload_img_file").val(); 
		var extStart=filepath.lastIndexOf("."); 
		var ext=filepath.substring(extStart,filepath.length).toUpperCase(); 
		if(ext!=".PNG"&&ext!=".JPG"&&ext!=".JPEG"&&ext!=".GIF"){ 
			alert("图片限于png,jpeg,jpg,gif格式"); 
			return ; 
		}
		$(".upload_box").hide();
		$(".pic_box").append("<div style='line-height:100px;font-size:14px;'>请稍后......</div>");
		
		$("#doing_upload_img_form").ajaxSubmit({
			dataType : 'json',
			cache : false,
			success : function(data) {
				if(IsNull(data)){
					alert("上传图片失败，请重新上传！");
					$("#lb_pic").empty().hide();
				}else{
					addDoingProduct(data);
				}
				
			},
			error : function(err) {
			//	alert(err);
			}
		});
		
		return false;
	}
	
	function addDoingProduct(data){
		if(doingImgList.size() < 3){
			var divHtml = '<li type="doing_img" class="p_f"><div class="r5"><a href="javascript:;" onclick="delDoingImg(this)" class="del"></a><img src="'+data.imageServer+data.thumbnail+'_100x100.jpg" class="i"></div></li>';
			$("#doing_product_list").append(divHtml);
			doingImgList.add(data);
			$("#lb_pic").empty().hide();
		}else{
			alert("最多只能发三张图片");
			$("#lb_pic").empty().hide();
		}
		
	}
</script>
<div
	style="margin: 0; padding: 0; border: 0; outline: 0; font-size: 100%; vertical-align: baseline; background: transparent;">
	<table class="lb_wrap">
		<tbody>
			<tr>
				<td class="topleft"></td>
				<td class="border"></td>
				<td class="topright"></td>
			</tr>
			<tr>
				<td class="border"></td>
				<td class="content">
					<div class="lb_hd">
						<span>选择您要上传的图片（支持GIF/JPG/PNG，最大4M）</span><a href="javascript:;"
							class="lb_close"></a>
					</div>
					<div class="lb_bd">
						<div class="pic_box">
							<div class="clearfix upload_box" style="float: none;">
								<form class="picUploadForm" id="doing_upload_img_form" action="doingImgUpload.htm"
									method="POST" enctype="multipart/form-data">
									<div class="upload_img mb20">
										<input type="button" class="green_button upload_btn r3" style="margin-left: 160px;"
											value="上传图片">
										<input onchange="doingUploadImgNew();return false;" type="file" id="upload_img_file" class="tfile" name="image">
									</div>
								</form>
							</div>
						</div>
					</div>
				</td>
				<td class="border"></td>
			</tr>
			<tr>
				<td class="bottomleft"></td>
				<td class="border"></td>
				<td class="bottomright"></td>
			</tr>
		</tbody>
	</table>
</div>


